
<div class="row-fluid">
    <div class="box paint color_11">
        <div class="title">
            <h4> <span><?php echo __('Add Distributions'); ?></span> </h4>
        </div>
        <!-- End .title -->
        
        <div class="content">
             <div id="wizard">
                <ul class="nav nav-tabs">
                  <li class="active"><a href="#step-1" data-toggle="tab">Passo 1: Definir dados inicias</a></li>
                  <li><a href="#step-2" data-toggle="tab" id="step2">Passo 2: Definir situação dos professores</a></li>
                  <li><a href="#step-3" data-toggle="tab" id="step3">Passo 3: Montar distribuição</a></li>
                </ul>
                <?php echo $this->Form->create('Distribution', array('class' => 'form-horizontal row-fluid', 'id' => 'distribution')); ?>
                <div class="tab-content">
                
                <div class="tab-pane fade in active" id="step-1">
                    
                        <div class="form-row control-group row-fluid">
                            <label class="control-label span3" for="normal-field"><?php echo __('Name') ?></label>
                            <div class="controls span7">
                                <?php echo $this->Form->input('name', array('div' => false, 'label' => false, 'class' => 'row-fluid')); ?>
                            </div>
                        </div>
                        <div class="form-row control-group row-fluid">
                            <label class="control-label span3" for="normal-field"><?php echo __('Year') ?></label>
                            <div class="controls span7">
                                <?php echo $this->Form->input('year', array('div' => false, 'label' => false, 'class' => 'row-fluid')); ?>
                            </div>
                        </div>

                        <div class="form-actions row-fluid">
                            <div class="span7 offset3">
                                <button class="btn btn-primary" id="next"><?php echo __('Next Step') ?></button>
                            </div>
                        </div>
                    
                </div>
                <div class="tab-pane fade" id="step-2">
                    <table id="datatable" class="responsive table table-striped table-bordered" style="width:100%;margin-bottom:0; ">
                        <thead>
                            <tr>
                                <th><?php echo __('Name') ?></th>
                                <th><?php echo __('Situation on 1º Semester') ?></th>
                                <th><?php echo __('Situation on 2º Semester') ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr class="checkAll">
                                <td></td>
                                <td>
                                    <div class="row-fluid">
                                        <div class="span12"><button name="1" class="btn btn-primary" >Selecionar/Deselecionar todos</button></div>
                                    </div>
                                </td>
                                <td>
                                    <div class="row-fluid">
                                        
                                        <div class="span12"><button name="2" class="btn btn-primary" >Selecionar/Deselecionar todos</button></div>
                                    </div>
                                </td>
                            </tr>
                            <?php
                            foreach ($teachers as $teacher): ?>
                            <tr>
                                <td><?php echo h($teacher['Teacher']['name']); ?>&nbsp;</td>
                                <td>
                                    <div class="row-fluid">
                                        <label class="control-label span3" for="normal-field"><?php echo __('Available') ?></label>
                                        
                                        <div class="span9"><input rel="1" type="checkbox" name="<?php echo h($teacher['Teacher']['id']); ?>[0]" /></div>
                                    </div>
                                </td>
                                <td> 
                                    <div class="row-fluid">
                                        <label class="control-label span3" for="normal-field"><?php echo __('Available') ?></label>
                                        
                                        <div class="span9"><input rel="2" type="checkbox" name="<?php echo h($teacher['Teacher']['id']); ?>[1]" /></div>
                                    </div>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                        </tbody>
                    </table>
                    <div class="form-actions row-fluid">
                        <div class="span7 offset3">
                            <button class="btn btn-primary" id="next2"><?php echo __('Next Step') ?></button>
                        </div>
                    </div>
                </div>
                <div class="tab-pane fade" id="step-3">
                    <div class="row-fluid fluid">
                        <div class="span12 well pagination-centered">
                            <button type="submit" class="btn btn-primary btn-large" id="submit">Criar a distribuição</button>
                            <button type="submit" class="btn btn-primary btn-large" id="save" style="display:none">Salvar e finalizar</button>
                        </div>
                        
                    </div>
                    <div class="row-fluid fluid">
                        <div class="span12 well pagination-centered" id="load" style="display:none">
                            <div id="loadingAjax" ><img src="<?php echo $this->Html->url('/tema/') ?>img/ajax-loader.gif"></div>
                        </div>
                        
                        <div class="span12 well pagination-centered" id="dist">
                            
                        </div>
                    </div>
                </div>
                
              </div>
              <?php $this->Form->end() ?>
            </div>
           
        </div>
        <!-- End .content --> 
    </div>
    <!-- End box --> 
</div>
<!-- End .row-fluid -->
 <?php
    $this->Js->get("#submit");

    echo $this->Js->event('click', $this->Js->request(
            array('action' => 'runGraph'),
            array(
                'async' => true,
                'method' => 'post',
                
                'dataExpression' => true,
                'data' => $this->Js->serializeForm(array('isForm' => false, 'inline' => true)),
                'evalScripts' => true,
                'update' => '#dist',
                'before' => '$("#load").fadeIn()',
                'complete' => '$("#load").fadeOut(); $("#save").fadeIn()',
                'type' => 'json'
                )
        ));
    
 ?>

 